//
//  MapView.swift
//  ChinaLandmarkDemo
//
//  Created by liy on 2025/2/10.
//

import MapKit
import SwiftUI

struct MapView: UIViewRepresentable {
  let center: CLLocationCoordinate2D

  func makeUIView(context: Context) -> MKMapView {
    MKMapView()
  }

  func updateUIView(_ uiView: UIViewType, context: Context) {
    uiView.setRegion(MKCoordinateRegion(
      center: center,
      span: MKCoordinateSpan(latitudeDelta: 0.02, longitudeDelta: 0.02)
    ), animated: true)
  }
}

#Preview {
  MapView(
    center: CLLocationCoordinate2D(
      latitude: 30.0,
      longitude: 130.0
    )
  )
}
